package cn.initcap.common;

import lombok.Getter;

/**
 * @author initcap
 * @date Created in 2018/8/8 PM1:10.
 */
@Getter
public enum ErrorCode {

    // 通用错误代码
    SYSTEM_ERROR(500100, "系统异常"),
    SUCCESS(0, "SUCCESS"),
    BIND_ERROR(500101, "参数校验异常：%s"),
    REQUEST_ILLEGAL(500102, "请求非法"),
    ACCESS_LIMIT_REACHED(500104, "访问太频繁！"),

    // 登录模块
    SESSION_ERROR(500210, "Session不存在或者已经失效"),
    PASSWORD_EMPTY(500211, "登录密码不能为空"),
    MOBILE_EMPTY(500212, "手机号不能为空"),
    MOBILE_ERROR(500213, "手机号格式错误"),
    MOBILE_NOT_EXIST(500214, "手机号不存在"),
    PASSWORD_ERROR(500215, "密码错误"),

    // 订单模块
    ORDER_NOT_EXIST(500400, "订单不存在"),

    // 秒杀模块
    SECKILL_OVER(500500, "商品已经秒杀完毕"),
    REPEATE_MIAOSHA(500501, "不能重复秒杀"),
    SECKILL_FAIL(500502, "秒杀失败");

    private int code;

    private String msg;

    ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
